import copy

xdata = [
        ['小泉纯一郎', '小犬'],
        ['毛泽东', '润之'],
        [None, None],
        ['毛泽东', '毛主席'],
        ['平', None],
        ['刘备', '大耳'],
        [None, '习近平'],
        ['刘皇叔', '刘玄德'],
        ['刘备', '刘玄德'],
        ['金三胖', '金正恩'],
        [None, '金正日'],
        ['金正日', '金二胖'],
    ]


def processing(data: list):
    sequential = [list(set(data[0]))]
    for idx, names in enumerate(data):
        exist = 0
        if idx >= 1:
            if len(list(set(names))) >= 2 or list(set(names))[0] is not None:
                for name in names:
                    for id_ in range(len(sequential)):
                        if name not in sequential[id_]:
                            continue
                        else:
                            exist = 1
                            names_ = [n for n in names if n is not None]
                            sequential[id_] += names_
                            sequential[id_] = list(set(sequential[id_]))
                            break
                    if exist == 1:
                        break
                if exist == 0:
                    names_ = [n for n in data[idx] if n is not None]
                    sequential.append(list(set(names_)))
    return sequential


seq = processing(xdata)

while True:
    seq_reset = processing(seq)
    if len(seq) == len(seq_reset):
        break
    seq = copy.deepcopy(seq_reset)

print('输出：')
for entities in seq:
    print(tuple(entities))

# 输出：
# ('平',)
# ('刘皇叔', '大耳', '刘玄德', '刘备')
# ('小泉纯一郎', '小犬')
# ('润之', '毛泽东', '毛主席')
# ('金三胖', '金正恩')
# ('金正日', '金二胖')
